<template>
  <div class="app-container">
    <el-card class="box-card">
      <div slot="header" class="clearfix">
        <span>通讯录新增</span>
      </div>
      <div>
        <div style="height: 350px;overflow-y: auto;overflow-x: hidden;">
        <el-form :model="ruleForm" status-icon :rules="rules" ref="ruleForm"  size="small" label-width="100px" class="demo-ruleForm">
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="姓名" prop="name">
                <el-input v-model="ruleForm.name"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="部门">
                <el-input v-model="ruleForm.dept"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="职务">
                <el-input v-model="ruleForm.duies"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="电子邮件">
                <el-input v-model="ruleForm.email"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="移动电话">
                <el-input v-model="ruleForm.mobilePhone"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="固定电话">
                <el-input v-model="ruleForm.telePhone"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="QQ号">
                <el-input v-model="ruleForm.qq"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="微信号">
                <el-input v-model="ruleForm.wechat"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="联系地址">
                <el-input v-model="ruleForm.address"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="办公地点">
                <el-input v-model="ruleForm.office"></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row :gutter="5">
            <el-col :span="12">
              <el-form-item label="备注信息">
                <el-input
                  type="textarea"
                  :rows="2"
                  placeholder="请输入内容"
                  v-model="ruleForm.remarks">
                </el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
        </div>
        <div style="margin-top: 15px;">
          <el-row :gutter="5">
            <el-col style="text-align: right;">
              <el-button class="filter-item" type="primary" @click="saveData">保存</el-button>
              <el-button class="filter-item" type="primary" @click="closeSelf">关 闭</el-button>
            </el-col>
          </el-row>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  name: 'changePassword',
  data() {
    return {
      options: [],
      formData: {},
      politicsList: {
        condition: [
          {
            property: 'codeType',
            value: 'USER_POLITICAL_STATUS',
            type: 'EQ'
          }
        ]
      },
      postlist: {
        userId: ''
      },
      ruleForm: {
        name: '',
        sendStatus: '',
        duies: '',
        email: '',
        mobilePhone: '',
        telePhone: '',
        qq: '',
        wechat: '',
        address: '',
        office: '',
        remarks: '',
        fcUser: '',
        fcTime: '',
        lmUser: '',
        lmTime: ''
      },
      rules: {
        name: [
          { required: true, message: '请填写姓名', trigger: 'blur' }
        ]
        // telephone: [
        //   { min: 11, max: 11, message: '请输入11位电话号', trigger: 'blur' }
        // ]
      }
    }
  },
  mounted() {
    // this.fetchData()
  },
  methods: {
    fetchData() {

    },
    fcTimeTime() {

    },
    lmTimeTime() {

    },
    closeSelf() {
      this.$router.push({ name: 'addressBookInformation' })
    },
    saveData() {
      this.formData = this.ruleForm
      if (this.formData.name) {
        this.$store
          .dispatch('AddressBookInformationCr', this.formData)
          .then(res => {
            this.$message({
              message: '添加成功',
              type: 'success'
            })
            this.$router.push({ name: 'addressBookInformation' })
          })
          .catch(() => {

          })
      } else {
        this.$message({
          message: '请填写姓名',
          type: 'error'
        })
      }
    },
    birthdayTime(val) {
      // this.ruleForm.birthday = val + '000000'
    },
    workDateTime(val) {
      // this.ruleForm.workDate = val + '000000'
    },
    employedDateTime(val) {
      // this.ruleForm.employedDate = val + '000000'
    }
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
</style>
